ActiveReports 8
Using the WPF Viewer
Show AllShow All
Hide AllHide All

ActiveReports provides the WPF Viewer that you can use to load and view your reports. This viewer contains a toolbar and a sidebar with Thumbnails, Search results, Document map and Parameters panes.

Warning: The TargetInvocationException occurs on running a WPF browser application in Partial Trust. Refer to Running WPF Viewer in Partial Trust section given below to run your WPF Browser Application in Partial Trust. To ensure that you are using Full Trust:

  1. From the Visual Studio Project menu, select YourProject Properties.
  2. On the Security tab, under Enable ClickOnce security settings, select the This is a full trust application option.

WPF Viewer Toolbar

WPF Viewer Sidebar

Display the report in the WPF Viewer

Set up your WPF Application project by using the following steps.

  1. Create a new WPF Application project or open an existing one.
  2. For a new project, in the Visual Studio Solution Explorer, right-click YourProject and select Add, then New Item.
  3. In the Add New Item dialog that appears, select the ActiveReports 8 Page Report, ActiveReports 8 Section Report (code-based) or ActiveReports 8 Section Report (xml-based). This adds the necessary references to your project.
  4. From the Toolbox ActiveReports 8 tab, drag the Viewer control and drop it on the design view of MainWindow.xaml.
    Note: Dragging the Viewer control to the design view of MainWindow.xaml automatically adds the corresponding reference to the licenses.licx file.
  5. In the Properties window, with the report selected, set Copy to Output Directory to Copy Always.
  6. On MainWindow.xaml, with the viewer selected, go to the Properties window and double click the Loaded event.
  7. In the MainWindow code view that appears, add code like the following to the viewer1_loaded event to bind the report to the viewer. Each of these code snippets presumes a report in the project of the type indicated with the default name. (If you have renamed your report, you need to rename it in the code as well).
    Note: Refer to the LoadDocument method to see other ways to load a report in WPF Viewer.

    To write the code in Visual Basic.NET

    To write the code in C#

Additional Features

Following is an introduction to the additional capabilities of the Viewer to guide you on using it effectively.

Keyboard Shortcuts

Running WPF Viewer in Partial Trust

You can run a WPF Viewer Browser Application in Partial Trust by customizing the permission set in the app.mainfest file. While customizing the permission set, some of the permissions are to be set explicitly like MediaPermission, UIPermission, etc. Follow these steps to learn how to run a WPF Viewer application in partial trust.

Note: These steps assume that you have already created a WPF Browser Application that contains the WPF Viewer control.
  1. In the Solution Explorer, right-click your WPF Browser Application and select Properties.
  2. On the properties page that opens, go to the Security tab.
  3. On the Security tab, set Zone your application will be installed from to Custom and click the Edit Permissions XML button. This opens the app.mainfest file.
  4. In the app.manifest file, replace the existing xml code inside the <applicationRequestMinimum> </applicationRequestMinimum> tags with the following code.

    Code

  5. Press F5 to run your WPF Browser Application.
Note: The Partial Trust Limitations are applicable to the WPF viewer running in Partial Trust. For more information, see Medium Trust Support.
See Also

Walkthroughs

Support Forum